<include file="Public:head_nosearch" />
<style type="text/css">
	html,body{height: 100%;}
</style>
	<div class="form">
		<h3>新用户注册</h3>
		<form action="{:U('login/register')}"  method="post" id="register">
			<div class="inputbox">
				<span class="iconfont tqk-yonghu1"></span>
				<input type="tel" name="phone" autocomplete="off" id="phone" placeholder="请输入您的手机号" />
			</div>
			<div class="inputbox">
				<span class="iconfont tqk-password"></span>
				<input type="password" autocomplete="off" name="password" id="password" placeholder="请输入您的密码" />
			</div>
			<div class="inputbox">
				<span class="iconfont tqk-password"></span>
				<input type="password" autocomplete="off" name="repassword" id="repassword" placeholder="请重复输入您的密码" />
			</div>
			<div class="inputbox">
				<span class="iconfont tqk-bangding1"></span>
				<input type="text" autocomplete="off" name="invocode" id="invocode" placeholder="有邀请码请填写 注意大小写" />
			</div>
			<div class="inputbox code">
				<span class="iconfont tqk-yanzhengma2"></span>
				<input type="text" name="verify" id="verify" placeholder="请输入验证码" style="width: 49%;" />
				<img src="{:U('login/verify')}" id="verifyImg" height="43" class="am-fr">
			</div>
			<input type="submit" value="确认注册" class="am-btn am-btn-block am-btn-danger am-radius am-btn-lg"/>
			
			<a class="am-btn am-btn-block am-btn-default am-radius am-btn-lg" href="{:U('login/index')}{$trackurl}">返回登录</a>
			
			<div style="background: #fff;height: 30px;">
				
			</div>
		</form>
	</div>
<include file="Public:foot" />
		<script type="text/javascript">
	$(function(){
			function changeVerify(){
				 document.getElementById('verifyImg').src='{:U("login/verify")}'; 
			}
			
		$("#verifyImg").on('click',function(){
			changeVerify();
		});
			
			$("#register").validate({
				rules:{
					phone:{
						required: true,
						isMobile:true,
					},
					password:{
						required: true,
					},
					repassword:{
						required: true,
						equalTo:"#password"
					},
					verify:{
						required: true,
					}
				},
				messages:{
					phone:{
						required: "请输入手机号",
						isMobile:"请输入正确格式的手机号",
					},
					password:{
						required: "请输入密码",
					},
					repassword:{
						required: "请重复输入密码",
						equalTo:"两次密码输入不一致"
					},
					verify:{
						required: "请输入验证码",
					}
				},
				submitHandler: function(form) 
			    {
					$(form).ajaxSubmit({
						success: function(json) {
							if(json.status == 1){
								layer.msg(json.msg, {icon:6});
								setTimeout(function(){
									location.href = "{:U('user/ucenter')}";
								},1000);
							}else{
								layer.msg(json.msg, {icon:5});
							}
			            }
					});     
			    }
			})
			changeVerify();
	});
		</script>
	</body>
</html>
